import Vue from 'vue'
import Router from 'vue-router'
import home from '@/page/home'
import readDetail from '@/page/readDetail'
import course from '@/page/course'
import courseDetail from '@/page/courseDetail'
import search from '@/page/search'

import admin from '@/page/admin/index'
import project from '@/page/admin/project'
import typeList from '@/page/admin/type'
import news from '@/page/admin/news'
Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'home',
      component: home
    },
    {
      path: '/read/:id',
      name: 'readDetail',
      component: readDetail
    },
    {
      path: '/search/:name',
      name: 'search',
      component: search
    },
    {
      path: '/course',
      component: course
    },
    {
      path: '/course/:name',
      name: 'courseDetail',
      component: courseDetail
    },
    {
      path: '/home',
      redirect: '/'
    },
    {
      path: '/admin',
      component: admin
    },
    {
      path: '/admin/project',
      component: project
    },
    {
      path: '/admin/type',
      component: typeList
    },
    {
      path: '/admin/news',
      component: news
    }
  ]
})
